package com.cytech.cloudclinic.moudle.main.patient;

import com.cytech.cloudclinic.base.BaseBean;
import com.cytech.cloudclinic.base.BaseObserver;
import com.cytech.cloudclinic.base.BasePresenter;
import com.cytech.cloudclinic.bean.Patient;
import com.cytech.cloudclinic.bean.UserInfo;
import com.cytech.cloudclinic.bean.req.BasePage;
import com.cytech.cloudclinic.bean.req.GetPatient;
import com.cytech.cloudclinic.bean.resp.RespPatientList;
import com.yechaoa.yutils.ToastUtil;

import java.util.List;

public class PatientPresenter extends BasePresenter<PatientView> {
    public PatientPresenter(PatientView baseView) {
        super(baseView);
    }

    /**
     * 获取患者列表
     */
    void getPatientList() {
        BasePage page = new BasePage();
        addDisposable(apiServer.getPatientManagerList(objectToRequestBody(page)), new BaseObserver<BaseBean<List<Patient>>>(baseView, true) {

            @Override
            public void onSuccess(BaseBean<List<Patient>> o) {
                baseView.getPatientListSuccess(o.result);
            }

            @Override
            public void onError(String msg) {
                ToastUtil.showToast(msg);
            }
        });
    }
}
